<?php
 
// no direct access
defined('_JEXEC') or die('Restricted access');

// import application view
jimport('joomla.application.component.view');

class SyncrViewIndividual extends JView
{
	public function display($tpl = null)
	{
		$db =& JFactory::getDBO();
		
		// site select
		$query = 'SELECT id AS value, name '
			. ' FROM ' . $db->nameQuote('#__syncr_sites')
			. ' ORDER BY name ASC '
			;
		$db->setQuery($query);
		$sitelist[] = JHTML::_('select.option',  '0', '- '.JText::_('SELECT_SITE').' -', 'value', 'name');
		$sitelist = array_merge($sitelist, $db->loadObjectList());
		$lists['sites']['left'] = JHTML::_('select.genericlist', $sitelist, 'leftSiteSelect', 'class="inputbox siteSelect"', 'value', 'name', '');
		$lists['sites']['right'] = JHTML::_('select.genericlist', $sitelist, 'rightSiteSelect', 'class="inputbox siteSelect"', 'value', 'name', '');
				
		// category select
		$categorylist[] = JHTML::_('select.option',  '0', '- '.JText::_('Select Category').' -', 'value', 'name');
		$lists['categories']['left'] = JHTML::_('select.genericlist', $categorylist, 'leftCategorySelect', 'class="inputbox categorySelect"', 'value', 'name', '');
		$lists['categories']['right'] = JHTML::_('select.genericlist', $categorylist, 'rightCategorySelect', 'class="inputbox categorySelect"', 'value', 'name', '');
		
		$this->assignRef('lists', $lists);
		
		// set toolbar
		$this->_setToolBar();
		
		// call parent behavior with template
		parent::display($tpl);
	}
	
	private function _setToolBar() {
		JToolBarHelper::title(JText::_('SYNCR_INDIVIDUAL_SITE'), 'generic.png');
		JToolBarHelper::preferences('com_syncr', 350);
	}
}